#!/usr/bin/env python3
import pika
import time
import json
from subprocess import Popen, PIPE
import sqlite3
import sys
import numpy as np

con = sqlite3.connect("../EP_faceDB/faceiddatabase.db3")
cur = con.cursor()
try:
    cur.execute('CREATE TABLE facedb(face_id TEXT, face_featurevector TEXT PRIMARY KEY)')
    con.commit()
except:
    print("db is already exists.")

for i in range(850):
    print(i)
    curfaceid = "test"
    testarray = np.random.randn(512)
    testlist = testarray.tolist()
    curfacevec = str(testlist)
    try:
        cur.execute("INSERT INTO facedb(face_id, face_featurevector) VALUES('%s', '%s')" % (curfaceid, curfacevec))
        con.commit()
    except:
        print("current face vector of bbox is already exists.")
    time.sleep(0.2)

con.close()


